package Table;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

import chucnang.TongHop;

public class TDanhSachBanHang extends JPanel {
	public  JTable tabledsbanhang;
	public DefaultTableModel model;
	String[][] data = {};
    String[] colunms = {"Mã Hàng","Tên Hàng","Kho Hàng","Đơn Vị","Đơn Giá","Số Lượng","Thành Tiền","ID"};
    private TongHop tonghop;
    
    public TDanhSachBanHang(TongHop tonghop){
    	this.tonghop = tonghop;
    	this.setLayout(new BorderLayout());
    	JScrollPane scrollPane = new JScrollPane();
    	model = new DefaultTableModel(data, colunms);
    	tabledsbanhang = new JTable(model);
    	tabledsbanhang.getColumnModel().getColumn(1).setPreferredWidth(250);
    	tabledsbanhang.getColumnModel().getColumn(2).setPreferredWidth(150);
    	tabledsbanhang.getColumnModel().getColumn(7).setMaxWidth(0);
    	tabledsbanhang.getColumnModel().getColumn(7).setMinWidth(0);
    	tabledsbanhang.getColumnModel().getColumn(7).setPreferredWidth(0);
    	scrollPane.setViewportView(tabledsbanhang);
    	add(scrollPane,BorderLayout.CENTER);
    }
}
